<?php
class StreamListAction extends Action{
	
	public function main(){
		$obj = new  StreamInfoDAO();
		$selected = new Selected();
		$ChannelID = (int) $this->_request['channelid'];
		$ClassID = (int) $this->_request['classid'];
		if ($ChannelID) {
			$obj3 = new ChannelStreamRelationDAO();
			$ret3 = $obj3->getByChannelID($ChannelID);
			if ($ret3) {
				$streamids = implode(",", $ret3);
				$ret = $obj->getListByID($streamids);
			}
			
		}else{
			$ret = $obj->getList();
		}
		if ($ret){
			for ($i=0; $i < count($ret); $i++) { 
				$ret[$i]['TaskStatus'] = $selected->getVal("TaskStatus",$ret[$i]['TaskStatus']);
				$ret[$i]['ClassID'] = $ClassID;
				$ret[$i]['PlayMode'] = $selected->getVal("PlayMode",$ret[$i]['PlayMode']);
				$ret[$i]['StreamEnable'] = $selected->getVal("StreamEnable",$ret[$i]['StreamEnable']);
				$ret[$i]['StreamDisplay'] = $selected->getVal("StreamDisplay",$ret[$i]['StreamDisplay']);
				$ret[$i]['StreamDisplayOrder'] = $selected->getVal("StreamDisplayOrder",$ret[$i]['StreamDisplayOrder']);
			}
		}
		$this->_response['ret'] = $ret;
		//debug($this->_response['ret']);
	}

}